Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function TryAdd ( _
key As TKey, _
value As TValue _
) As Boolean |
C# |
---|
public bool TryAdd(
TKey key,
TValue value
) |
Parameters
- key
- Type: TKey
The key of the element to add.
- value
- Type: TValue
The value of the element to add. The value can be a null reference (Nothing
in Visual Basic) for reference types.
Return Value
true if the key/value pair was added to the
ConcurrentDictionary<(Of <(TKey, TValue>)>)
successfully; otherwise, false.
Exceptions
See Also